jest-leak-detector
Module for verifying whether an object has been garbage collected or not.
Internally creates a weak reference to the object, and forces garbage collection to happen. If the reference is gone, it meant no one else was pointing to the object.
Example
(async function () {
let reference = {};
let isLeaking;
const detector = new LeakDetector(reference);
isLeaking = await detector.isLeaking();
console.log(isLeaking);
reference = null;
isLeaking = await detector.isLeaking();
console.log(isLeaking);
})();